<?php
require('_drawrating.php');
require('getUsersGameList.php');



if(isset($_SESSION["userId"])){
	$myFav = $myFav."javascript: jQuery.facebox({div:'#box'},'test','$path','trim($url)','trim($gameName)');";
	$myList="javascript: jQuery.facebox({div:'#gameList'},'test','$path','trim($url)','trim($gameName);');";
	$userid=$_SESSION["userId"];
}else{
	$myFav="javascript: jQuery.facebox({div:'#login_popup'});";
	$myList="javascript: jQuery.facebox({div:'#login_popup'});";
}
?>

	<div class="main_panel">
        		<div style="width:100%;float:left;">
                	<div style="background:#e9e9e9;width:100%;height:100px;"> Reklam </div>

                    	<div id="gameHeader" class="gameHeader" style="height:20px;"><div style="float:left;width:200px;margin-top:3px;"><?php echo "".$gameName; ?></div> <div id="bar1" style="float:right;font-weight:normal;"></div></div>
                    <div style="width:100%;float:left;">
           		  	  <script type="text/javascript" >
        					oyun("mode1100101000111","","1947","<?php echo trim($url);?>");
                    	</script>
                    </div>
                     <div style="width:100%;float:left;">
                          <div class="vp_functions_container">
                          <div class="vp_functions_left">
                          <ul id="vp_functions">
                            <li> <a href="<?php echo $myFav;?>" id="vp_favorim" title="Favorilerinize Ekleyin">Favorilerime Ekle</a></li>
                            <li><a href="<?php echo $myList;?>" id="vp_share" title="Oyun Listeme Ekle">Oyun Listeme Ekle</a></li>
							<li><a href="<?php getNextGame($gId);?>" id="vp_next" title="Sıradaki Oyun">Sıradaki Oyun</a></li>
                            <li><a href="<?php getRandGame();?>" id="vp_random" title="Rastgele Oyun Seç">Rastgele Oyun</a></li>
                          </ul>
                          
                        </div>
                        <div class="vp_functions_right" style="float:right;margin-right:-5px;">
                            <?php echo rating_bar($gId,'5'); ?>
                        </div>
                       </div>
                        <input type="button" style="display:none;" name="buttonSuccess" id="successButton" value="button"  onclick="javascript: jQuery.facebox({div:'#success'});"/>
                        <input type="button" style="display:none;" name="buttonFail" id="failButton" value="Submit"  onclick="javascript: jQuery.facebox({div:'#fail'});"/>
                  </div> 
                </div>
    </div>
            
            <!--  Popup menu lerin olduğu bolum -->
            
        <div id="box" style="width:350px;height:150px;display:none;">
          <table width="350px" border="0">
            <tr>
              <td height="32" colspan="2" bgcolor="#3b5998"><h2><span style="font-size:13px;color:#FFF;margin-left:10px;">Favorilerime Ekle</span></h2></td>
            </tr>
            <tr>
              <td height="124" colspan="2"><div class="fbgm" style="width:305px;"><img hspace='10px' align='center' src='<?php echo $picUrl?>' alt='AK Status' width='75' height='75' style="float:left;"/><span class="fbx-tiny" style="margin-top:15px;font-size:12px;"><?php echo $gameName?> <br/>
                <br/>
              <!--<a href="">Hemen Oyna</a>-->
              </span></div></td>
            </tr>
            <tr>
              
              <td align="right">
					<input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida="lucida" grande="grande"", tahoma, verdana,="verdana," arial,="arial," sans-serif;font-size:="sans-serif;font-size:" 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.open();" class="open" name="buttonOpen" id="buttonOpen2"  value="    Ekle    " />
					<input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida="lucida" grande="grande"", tahoma, verdana,="verdana," arial,="arial," sans-serif;font-size:="sans-serif;font-size:" 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.close();" class="close" name="button2" id="button2"  value="    Iptal    " /></td>
            </tr>	
          </table>
        </div>
        
        
        <div id="gameList" style="border: solid; width: 350px;height:200px;display:none;">
          <table width="350px" border="0">
            <tr>
              <td height="32" colspan="2" bgcolor="#3b5998"><h2><span style="font-size:13px;color:#FFF;margin-left:10px;">Oyun Listeme Ekle</span></h2></td>
            </tr>
            <tr>
              <td height="28" colspan="2"><div class="fbgm" style="width:305px;">
                <table width="100%" height="83" border="0">
                  <tr>
                    <td width="26%" rowspan="2"><img hspace='10px' align='center' src='<?php echo $picUrl?>' alt='AK Status' width='75' height='75' style="float:left;"/></td>
                    <td width="31%" height="36" style="font-size:12px;">Oyun Listelerim</td>
                    <td width="43%"><label>
                      <select id="selectGameList" class="fb_select" >
                      <?php getUsersGameLists($userid);?>   
                        </select>
                      </label></td>
                    </tr>
                  <tr>
                    <td height="41"></td>
                    <td height="41"><a   onclick="test();" style="cursor:pointer;font-size:12px;" >Yeni bir liste oluştur</a></td>
                    </tr>
                  </table>
              </div></td>
            </tr>
            <tr>
              <td align="right">
                <input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida="lucida" grande="grande"", tahoma, verdana,="verdana," arial,="arial," sans-serif;font-size:="sans-serif;font-size:" 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.gameList();" class="open" name="buttonOpen" id="buttonOpen2" title="open" value="    Ekle    " />
              <input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida="lucida" grande="grande"", tahoma, verdana,="verdana," arial,="arial," sans-serif;font-size:="sans-serif;font-size:" 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.close();" class="close" name="button2" id="button2" title="close" value="    Iptal    " /></td>
            </tr>
          </table>
        </div>

        
        
        <div id="fail" style="border: solid; width: 350px;height:150px;display:none">
          <table width="100%" border="0">
            <tr>
              <td width="100%" height="32" bgcolor="#3b5998"><h2><span style="font-size:13px;color:#FFF;margin-left:10px;">Oyun Eklenemedi</span></h2></td>
            </tr>
            <tr>
              <td height="28"><div  class="fb5">Oyun eklenirken hata oldu. Lütfen tekrar deneyin.</div></td>
            </tr>
            <tr>
              
              <td align="right" height="28">
                <input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida grande", tahoma, verdana, arial, sans-serif;font-size: 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.close();" class="close" name="button" id="button" title="close" value="    Tamam    " />
              </td>
            </tr>
            </table>
        </div>
        <!-- Login olmadıysa eğer login popup -->
        <div id="login_popup" style="border: solid; width: 350px;height:150px;display:none">
          <table width="100%" border="0">
            <tr>
              <td width="100%" height="32" bgcolor="#3b5998"><h2><span style="font-size:13px;color:#FFF;margin-left:10px;">Giriş Yapılmadı</span></h2></td>
            </tr>
            <tr>
              <td height="28"><div  class="fb5">Bu özelliği kullanmak için önce <a href="login.php">giriş</a> yapmalısınız!</div></td>
            </tr>
            <tr>
              
              <td align="right" height="28">
                <input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida grande", tahoma, verdana, arial, sans-serif;font-size: 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.close();" class="close" name="button" id="button" title="close" value="    Tamam    " />
              </td>
            </tr>
            </table>
        </div>
        
        <div id="success" style="border: solid; width: 350px;height:150px;display:none;">
          <table width="100%" border="0">
            <tr>
              <td width="100%" height="32" bgcolor="#3b5998"><h2><span style="font-size:13px;color:#FFF;margin-left:10px;">Oyun Eklendi</span></h2></td>
            </tr>
            <tr>
              <td height="28"><div  class="fb4">Oyun başarıyla eklendi.</div></td>
            </tr>
            <tr>
              
              <td align="right" height="28">
                <input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida grande", tahoma, verdana, arial, sans-serif;font-size: 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.close();" class="close" name="button" id="button" title="close" value="    Tamam    " />
              </td>
            </tr>
          </table>
        </div>
        
        <div id="successRefresh" style="border: solid; width: 350px;height:150px;display:none;">
          <table width="100%" border="0">
            <tr>
              <td width="100%" height="32" bgcolor="#3b5998"><h2><span style="font-size:13px;color:#FFF;margin-left:10px;">Oyun Eklendi</span></h2></td>
            </tr>
            <tr>
              <td height="28"><div  class="fb4">Oyun başarıyla eklendi.</div></td>
            </tr>
            <tr>
              
              <td align="right" height="28">
                <input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida grande", tahoma, verdana, arial, sans-serif;font-size: 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.close();" class="close" name="button" id="button" title="close" value="    Tamam    " />
              </td>
            </tr>
          </table>
        </div>
     
		<div id="newGameList" style="border: solid; width: 350px;height:120px;display:none;">
          <table width="100%" border="0">
            <tr>
              <td height="32" colspan="2" bgcolor="#3b5998"><h2><span style="font-size:13px;color:#FFF;margin-left:10px;">Oyun Listesi Oluştur</span></h2></td>
            </tr>
            <tr>
              <td height="28" colspan="2"><div class="fbgm" style="width:305px;height:40px;">
                  <table width="100%" height="38" border="0">
                    <tr>
                      <td width="34%" height="34" style="font-size:12px;">Liste Adı  : </td>
                      <td width="66%"><input type="text" name="gmListName" id="gmListName"/>
                        <input type="hidden" name="hiddenUserId" id="hiddenUserId" value="<?php echo $userid;?>"/>
                        <input type="hidden" name="hiddenUrl" id="hiddenUrl" value="<?php echo $url;?>"/>
                        <input type="hidden" name="hiddenPicUrl" id="hiddenPicUrl" value="<?php echo $picUrl;?>"/>
                        <input type="hidden" name="hiddenGameName" id="hiddenGameName" value="<?php echo $gameName;?>"/>
                        <input type="hidden" name="hiddenGameDesc" id="hiddenGameDesc" value="<?php echo $gameDesc;?>"/>
                        </td>
                      </tr>
                    </table>
                </div>
                
              </td>
            </tr>
            <tr>
              <td align="right">
                <input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida="lucida" grande="grande"", tahoma, verdana,="verdana," arial,="arial," sans-serif;font-size:="sans-serif;font-size:" 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.newGameList();" class="open" name="buttonOpen2" id="buttonOpen" title="open" value="    Ekle    " />
              <input type="button" style="background-color: #3b5998;padding:2px;cursor:pointer;border-color: #d8dfea rgb(14, 31, 91) rgb(14, 31, 91) rgb(216, 223, 234);border-style: solid;border-width: 1px;color: #fff;font-family: "lucida="lucida" grande="grande"", tahoma, verdana,="verdana," arial,="arial," sans-serif;font-size:="sans-serif;font-size:" 11px;margin: 0 2px;padding: 2px 18px;" onclick="$.facebox.close();" class="close" name="button3" id="button3" title="close" value="    Iptal    " />
			  </td>
            </tr>
          </table>
          
        </div>
     
     
     
            <!--  Popup menu sonu -->
        <input type="button" style="display:none;" name="buttonSuccess" id="successButton" value="button"  onclick="javascript: jQuery.facebox({div:'#success'});"/>
		<input type="button" style="display:none;" name="buttonFail" id="failButton" value="Submit"  onclick="javascript: jQuery.facebox({div:'#fail'});"/>           